
<template>
  <div>
    <el-dialog
      v-model="conf.aac_visible"
      title="密钥"
      width="30%"
      draggable
      :before-close="hide_aac"
    >
      <el-form
        :model="form_aac"
        size="small"
        ref="fm_aac"
        :rules="rules_aac"
      >

 <!--签名密钥 输入控件 -->
 <el-form-item prop="secret" label="签名密钥" label-width="100px" label-position="right">
   <el-input clearable style="width: 100%" v-model="form_aac.secret" maxlength="256"  type="textarea" show-word-limit  placeholder="请输入签名密钥" />
 </el-form-item>

      </el-form>
      <template #footer>
        <span class="dialog-footer">
          <el-button @click="hide_aac">取消</el-button>
          <el-button type="primary" @click="save_aac">提交</el-button>
        </span>
      </template>
    </el-dialog>
  </div>
</template>

<script>
export default {
  data(){
    return{
      conf:{
        aac_visible:false,
      },
  
      //密钥 form by  y
      form_aac:{secret:"",
    },
    
    rules_aac:{ 
          secret:[{required:false, message:"请输入签名密钥", trigger: 'blur'}],
        },


    }
  },
  methods:{
     //--------------------密钥---------------------------------
      //显示 密钥 弹出框
      show_aac(fm){
         Object.assign(this.form_aac,fm)
         this.conf.aac_visible = true;
      },
      //隐藏 密钥 弹出框
      hide_aac(){
        this.conf.aac_visible = false;
        this.$refs.fm_aac.resetFields();
      },
      //保存 密钥 弹出框数据
      save_aac(){
        let that = this
        this.$refs.fm_aac.validate((v=>{
            if(!v){
                return
            }
        let post_form_aac=this.form_aac
        
        this.$theia.http.post("/systeminfo/secret",post_form_aac).then(res=>{
            that.$notify.success({title: '成功',message: '提交成功',duration:5000})
            that.$emit("onsaved")
            that.hide_aac()
            
        }).catch(res=>{
          let code = res.response.status
          let msg= `提交失败(${code})`
          that.$notify.error({title: '失败',message:msg,duration:5000})
        })
        }))
    },
    //-----------------------------------------------------------
  },
}
</script>